<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>退出登录确认</title>
    <style>
        /* 让整个页面覆盖，并居中弹窗 */
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background: linear-gradient(to right, #4facfe, #00f2fe); /* 现代化背景 */
            font-family: Arial, sans-serif;
        }

        /* 弹窗背景 */
        .modal {
            display: none; /* 默认隐藏 */
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
        }

        /* 弹窗内容 */
        .modal-content {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 30px;
            border-radius: 12px;
            text-align: center;
            box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
            width: 350px;
        }

        /* 标题样式 */
        h2 {
            margin-bottom: 20px;
            color: #333;
            font-size: 22px;
        }

        /* 按钮样式 */
        .button-group {
            display: flex;
            justify-content: space-between;
            margin-top: 20px;
        }

        .button {
            padding: 12px 18px;
            font-size: 16px;
            border-radius: 6px;
            cursor: pointer;
            transition: 0.3s;
            border: none;
            width: 48%;
        }

        .confirm {
            background: #ff4b5c;
            color: white;
        }

        .confirm:hover {
            background: #c82333;
        }

        .cancel {
            background: #ccc;
            color: black;
        }

        .cancel:hover {
            background: #aaa;
        }
    </style>
</head>
<body>

    <!-- 弹窗 -->
    <div id="logoutModal" class="modal">
        <div class="modal-content">
            <h2>确认退出登录？</h2>
            <form id="logoutForm" action="/logout" method="post">
                <div class="button-group">
                    <button type="submit" class="button confirm">确认退出</button>
                    <button type="button" class="button cancel" onclick="closeModal()">取消</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        function openModal() {
            document.getElementById("logoutModal").style.display = "block";
        }
        openModal(); // 页面加载时自动弹出

        function closeModal() {
            document.getElementById("logoutModal").style.display = "none";
            window.history.go(-2);
        }
    </script>

</body>
</html>
